/*
	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.

	This program is distributed in the hope that it will be useful,
	but WITHOUT ANY WARRANTY; without even the implied warranty of
	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
	GNU Library General Public License for more details.

	You should have received a copy of the GNU General Public License
	along with this program; if not, write to the Free Software
	Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
*/

#ifndef STYLEEDITORIMPL_H
#define STYLEEDITORIMPL_H
//
#include "ui_styleeditor.h"

#include "stylemodel.h"
#include "configurationmodel.h"
//
class StyleEditorImpl : public QDialog, public Ui::StyleEditor
{
Q_OBJECT
public:
	StyleEditorImpl( QWidget * parent = 0, Qt::WFlags f = 0 );
	
	void setManagers(ConfigurationManager *confManager, StyleManager *styleManager);	
	void updateStyleList();

private slots:
	void on_tbSelectStyle_clicked();
	void on_cbFontSize_currentIndexChanged(int index);
	void on_ckUnderline_clicked();
	void on_ckItalic_clicked();
	void on_ckBold_clicked();
	void on_cbFont_currentIndexChanged(int index);
	void on_tbMoveUp_clicked();
	void on_tbMoveDown_clicked();
	void on_tbRemoveStyle_clicked();
	void on_tbAddStyle_clicked();
	void on_lwStyle_currentItemChanged(QListWidgetItem* current, QListWidgetItem* previous);
	void on_tbFontColor_clicked();
	void onFinished(int result);
	
private:
	QColor currentColor;
	StyleManager *m_styleManager;
	ConfigurationManager *m_confManager;
	
	int m_defaultFont;
	int m_defaultFontSize;
	
	void drawColor(QColor color);
	void fillComboSize();
	void initCombos();
	
	void updateModelFromUI(int index);
	void updateUIFromModel(int index);
	
	void updatePreview();
};
#endif






